package 线程基本使用;
class CountOperates extends Thread
{
	public CountOperates()
	{
		 System.out.println("CountOperate--begin");
		 System.out.println("currentThread().getName()="+currentThread().getName());
		 System.out.println("currentThread().isAlive()="+currentThread().isAlive());
		 System.out.println("this.getName()="+this.getName());
		 System.out.println("this.isAlive()="+this.isAlive());//判断thread-0是否调用
		 System.out.println("CountOperate--end");
	}
	public void run()//被thread-0线程调用
	{
		 System.out.println("run--begin");
		 System.out.println("currentThread().getName()="+currentThread().getName());
		 System.out.println("currentThread().isAlive()="+currentThread().isAlive());
		 System.out.println("this.getName()="+this.getName());
		 System.out.println("this.isAlive()="+this.isAlive());
		 System.out.println("run--end");
	}
}
public class Test1_24_1 {

	public static void main(String[] args) throws InterruptedException  {
		// TODO Auto-generated method stub
		/*CountOperates c=new CountOperates();
		Thread t1=new Thread(c);
		System.out.println("main begin t1 isAlive="+t1.isAlive());
		t1.setName("A");
		t1.start();
		System.out.println("main end t1 isAlive="+t1.isAlive());
		*/
	    CountOperates t1=new CountOperates();
		
		System.out.println("main begin t1 isAlive="+t1.isAlive());
		//t1.setName("A");
		t1.start();
		t1.sleep(5000);
		System.out.println("main end t1 isAlive="+t1.isAlive());
		//CountOperators的构造方法被main线程调用，run方法被thread-0线程调用
		

	}

}
